﻿using ShopPowerTemplate.Common;
using ShopPowerTemplate.Entities;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Windows.UI.Xaml.Media.Imaging;

namespace ShopPowerTemplate.ViewModels
{
    public class CategoryPresenterViewModel : BindableBase
    {
        public Category Category { get; set; }

        private BitmapImage bitmapImage;
        public BitmapImage BitmapImage
        {
            get { return bitmapImage; }
            set { this.SetProperty(ref bitmapImage, value); }
        }

        public CategoryPresenterViewModel(Category c)
        {
            Category = c;
            InitializeImage();
        }

        private async void InitializeImage()
        {
            if (Category.Image != null)
            {
                BitmapImage = await ZipHelper.ExtractImage(Category.Image);
            }
        }
    }
}
